
<template>
  <div>
    <!--阿里云播放器-->
    <ali-player :encryptType="1"
                :vid="vid"
                :playauth="playAuth"
                ref="player"
                :useFlashPrism="false"
                :autoplay="true"
                :isLive="false"
                :showBuffer="true"
                :showBarTime="true"
                :disableSeek="true"
                showBarTime="500"
                format="video"
                video-height="100%"

                width="800px"
                controlBarVisibility="always">
    </ali-player>
  </div>

</template>


<script>
import VueAliplayer from "../../components/AliPlayer/AliPlayer";
import video from "@/api/video"

export default {
  components: {"ali-player": VueAliplayer},
  data() {
    return {

      vid: '', //视频vid
      playAuth: '' //鉴权地址
    }
  },

  mounted:function() {
    this.init();

  },
  created() {
    //页面渲染之前执行
    // this.init();
  },

  methods: {
    init() {
      //判断路径有id值,做修改
      if (this.$route.params && this.$route.params.id) {
        //从路径获取id值
        const id = this.$route.params.id;
        this.vid=id;
        this.playAuth=this.$cookies.get("playAuth");
        console.log(this.$cookies.get("playAuth"))

      } else {
        //路径没有id值
        //清空表单
        this.playAuth = "";
      }
    },

  }
}
</script>
<style scoped>

</style>

